# Maintainer: Andrea Zagli <andrea.zagli.free@gmail.com>

pkgname=autoconf-archive
pkgver=2019.01.06
pkgrel=1
pkgdesc="Autoconf Macro Archive"
arch=('any')
license=('GPL3')
url="https://www.gnu.org/software/autoconf-archive"
conflicts=(gnome-common)
replaces=(gnome-common)
provides=(gnome-common)
source=(https://ftp.gnu.org/pub/gnu/${pkgname}/${pkgname}-${pkgver}.tar.xz
        msysize-autoconf-archive-2019.01.06.patch)
sha256sums=('17195c833098da79de5778ee90948f4c5d90ed1a0cf8391b4ab348e2ec511e3f'
            'd2afa48081316320faea33683eecf3eb146617a8cab85ae8590b4f7882c1a529')

# Helper macros to help make tasks easier #
apply_patch_with_msg() {
  for _patch in "$@"
  do
    msg2 "Applying $_patch"
    patch -Nbp1 -i "${srcdir}/$_patch"
  done
}

prepare() {
  cd ${srcdir}/${pkgname}-${pkgver}
  apply_patch_with_msg msysize-autoconf-archive-2019.01.06.patch
}

build() {
  cd ${srcdir}/${pkgname}-${pkgver}
  ./configure --prefix=/usr
  make
}

package() {
  cd ${srcdir}/${pkgname}-${pkgver}
  make DESTDIR=${pkgdir} install

  install -Dm644 COPYING $pkgdir/usr/share/licenses/${pkgname}-${pkgver}/COPYING
  install -Dm644 COPYING.EXCEPTION $pkgdir/usr/share/licenses/${pkgname}-${pkgver}/COPYING.EXCEPTION
}
